<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>

</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>互联互通</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>互联互通详情</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });
</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <div class="columns pull-left">
                        <h5 class="font-bold">互联互通详情</h5>
                    </div>
                    <div class="ibox-tools">
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t layui-form" id="frmHlhtTenantOpen">

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">设备商：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="tenantCode" name="tenantCode" value="${hlhtTenantOpen.tenantCode}" readonly>
                            </div>
                        </div>
                        <c:if test="${not empty hlhtTenantOpen.hlhtTenantCode}">
                            <div class="form-group row ">
                                <label class="col-sm-3 col-form-label text-right">运营商：</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="hlhtTenantCode" id="hlhtTenantCode" value="${hlhtTenantOpen.hlhtTenantCode}" readonly>
                                </div>
                            </div>
                        </c:if>
                        <c:if test="${not empty hlhtTenantOpen.hlhtOperatorId}">
                            <div class="form-group row">
                                <label class="col-sm-3 col-form-label text-right">运营商：</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="hlhtOperatorId" id="hlhtOperatorId" value="${hlhtTenantOpen.hlhtOperatorId}" readonly>
                                </div>
                            </div>
                        </c:if>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">互联开始时间：</label>
                            <div class="col-sm-8">

                                <input id="beginDate"
                                       name="beginDate"
                                       type="text"
                                       value="<fmt:formatDate value="${hlhtTenantOpen.beginDate}"
                                       pattern="yyyy-MM-dd" />" disabled class="form-control">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">互联结束时间：</label>
                            <div class="col-sm-8">
                                <input id="endDate"
                                       name="endDate"
                                       type="text"
                                       value="<fmt:formatDate value="${hlhtTenantOpen.endDate}"
                                       pattern="yyyy-MM-dd" />" disabled class="form-control">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">互联类型：</label>
                            <div class="col-sm-8">
                                <select class="form-control" disabled id="hlhtOpenType" name="hlhtOpenType">
                                    <option value="0" selected>内部互联</option>
                                    <option value="1" ${hlhtTenantOpen.hlhtOpenType=="1"?"selected":""}>外部互联</option>
                                    <option value="2" ${hlhtTenantOpen.hlhtOpenType=="2"?"selected":""}>政务互联</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">互联方向：</label>
                            <div class="col-sm-8">
                                <select class="form-control" disabled id="hlhtType" name="hlhtType">
                                    <option value="0" selected>反向</option>
                                    <option value="1" ${hlhtTenantOpen.hlhtType=="1"?"selected":""}>正向</option>
                                    <option value="2" ${hlhtTenantOpen.hlhtType=="2"?"selected":""}>双向</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">互联状态：</label>
                            <div class="col-sm-8">
                                <select class="form-control" disabled id="status" name="status">
                                    <option value="0" selected>已停用</option>
                                    <option value="1" ${hlhtTenantOpen.status=="1"?"selected":""}>互联中</option>
                                    <option value="2" ${hlhtTenantOpen.status=="2"?"selected":""}>已过期</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">结算方式：</label>
                            <div class="col-sm-8">
                                <select  class="form-control" disabled id="settleType" name="settleType">
                                    <option value="0" selected>瑞晨云代结算</option>
                                    <option value="1" ${hlhtTenantOpen.settleType=="1"?"selected":""}>直接对算结算</option>
                                    <option value="2" ${hlhtTenantOpen.settleType=="2"?"selected":""}>不需结算(政务类)</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">对接方式：</label>
                            <div class="col-sm-3" >
                                <input type="radio" class="form-control" lay-filter="joinType" name="joinType" ${hlhtTenantOpen.joinType=="0"?"checked":""} disabled value="0" title="瑞晨云">
                                <c:if test="${hlhtTenantOpen.joinType == '1'}">
                                <input type="radio" class="form-control" lay-filter="joinType" name="joinType" ${hlhtTenantOpen.joinType=="1"?"checked":""} disabled value="1" title="独立主体">
                                </c:if>
                            </div>
                        </div>
                    </form>
                    <div class="form-group row HlhtskTenantSelect hide">
                        <label class="col-sm-3 col-form-label text-right">新增互联运营商：</label>
                        <div class="col-sm-3">
                            <div class=''>
                                <select name="HlhtskTenant"id="HlhtskTenant" class="form-control" lay-filter="HlhtskTenant">
                                    <option value="">+添加互联运营商</option>
                                    <c:forEach items="${hlhtskGovtTenantOperatorList}" var="skGovTenOper" varStatus="statu">
                                        <option value="${skGovTenOper.tenantOperatorName}"> ${skGovTenOper.tenantOperatorName}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                    </div>
                    <form class="form-horizontal m-t layui-form ${hlhtTenantOpen.joinType=="0"?"":"hide"}" id="frmHlhtskTenantOpen1">
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">操作密钥：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="operatorSecret" id="operatorSecret" value="${hlhtskTenant.operatorSecret}" readonly>
                            </div>
                            <label class="col-sm-2 col-form-label text-right">加密密钥：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="dataSecret" id="dataSecret" value="${hlhtskTenant.dataSecret}" readonly>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">始化向量：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="dataSecretiv" id="dataSecretiv" value="${hlhtskTenant.dataSecretiv}" readonly>
                            </div>
                            <label class="col-sm-2 col-form-label text-right">签名密钥：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="sigSecret" id="sigSecret" value="${hlhtskTenant.sigSecret}" readonly>
                            </div>
                        </div>
                    </form>
                    <form class="form-horizontal m-t layui-form ${hlhtTenantOpen.joinType=="1"?"":"hide"}" id="frmHlhtskTenantOpen2" style="margin-top: 15px">
                        <fieldset class="layui-elem-field col-sm-9" style="margin: 0 auto">
                            <legend style="width: unset">劲天科技</legend>
                            <div class="layui-field-box">
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label text-right">运营商签名密钥：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="operatorSecret"  value="${hlhtskTenant.operatorSecret}" readonly>
                                    </div>
                                    <label class="col-sm-3 col-form-label text-right">运营商数据加密密钥：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="dataSecret" value="${hlhtskTenant.dataSecret}" readonly>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label text-right">运营商初始化向量：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="dataSecretiv" value="${hlhtskTenant.dataSecretiv}" readonly>
                                    </div>
                                    <label class="col-sm-3 col-form-label text-right">运营商操作密钥：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="sigSecret" value="${hlhtskTenant.sigSecret}" readonly>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                        <c:forEach items="${hlhtskGovtTenantOperatorList}" var="skGovTenOper">
                        <fieldset class="layui-elem-field col-sm-9" style="margin: 0 auto">
                            <label value="${skGovTenOper.govtTenantOperatorId}"></label>
                            <legend style="width: unset">${skGovTenOper.tenantOperatorName}</legend>
                            <div class="layui-field-box">
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label text-right">运营商签名密钥：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="operatorSecret"  value="${skGovTenOper.operatorSecret}" readonly>
                                    </div>
                                    <label class="col-sm-3 col-form-label text-right">运营商数据加密密钥：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="dataSecret"  value="${skGovTenOper.dataSecret}" readonly>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-sm-2 col-form-label text-right">运营商初始化向量：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="dataSecretiv"  value="${skGovTenOper.dataSecretiv}" readonly>
                                    </div>
                                    <label class="col-sm-3 col-form-label text-right">运营商操作密钥：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="sigSecret"  value="${skGovTenOper.sigSecret}" readonly>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                        </c:forEach>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    layui.use(['form', 'jquery', 'tree', 'laydate', 'util'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        //统一互联与分开互联切换
        form.on("radio(joinType)", function (data) {
            if ($(this).val() == "0") {
                $("#frmHlhtskTenantOpen1").removeClass("hide");
                $("#frmHlhtskTenantOpen2").addClass("hide");
                $(".HlhtskTenantSelect").addClass("hide")
            } else {
                $("#frmHlhtskTenantOpen1").addClass("hide");
                $("#frmHlhtskTenantOpen2").removeClass("hide");
                $(".HlhtskTenantSelect").removeClass("hide")
            }
        });
        //添加互联运营商
        $("#HlhtskTenant").change(function () {
            var str = '';
            var value = $(this).val();
            if(value){
                $("#HlhtskTenant option:selected").css("display","none");
            }
        })

        //删除运营商
        $("#frmHlhtskTenantOpen2").on("click",".del_btn",function () {
            var index = $(this).parents(".layui-elem-field").index();
            var tanentName = $(this).attr("tanentName")
            $(this).parents(".layui-elem-field").remove();
            $("#HlhtskTenant option").each(function () {
                if($(this).attr("value")==tanentName){
                    $(this).css("display","block")
                }
            })
        })
    });
    editHlhtTenantOpen.init();
</script>
</body>
</html>
